﻿Imports System.Data.SqlClient
Imports UTNComputers.clsCatalogo
Imports UTNComputers.clsCliente

Public Class clsSorteo
    Private mSort_Id As Int32
    Private mFecha As Date
    Private mProd_Id As Int32
    Private mCli_Id As Int32
    Private mEstado As String
    Private mProducto As clsCatalogo
    Private mCliente As clsCliente
    Private mCod_Suc As Int32

    '/////////////////////////////////////////////////////////
    '/ Propiedades
    '/////////////////////////////////////////////////////////
    Public Property Sort_Id() As Int32
        Get
            Return mSort_Id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mSort_Id = value
            Else
                Throw New Exception("No se puede utilizar el código del sorteo. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property
    Public Property Fecha() As Date
        Get
            Return mFecha
        End Get
        Set(ByVal value As Date)
            mFecha = value
        End Set
    End Property
    Public Property Prod_Id() As Int32
        Get
            Return mProd_Id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mProd_Id = value
            Else
                Throw New Exception("No se puede utilizar el código del producto. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property
    Public Property Cli_Id() As Int32
        Get
            Return mCli_Id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mCli_Id = value
            Else
                Throw New Exception("No se puede utilizar el código del cliente. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property
    Public Property Estado() As String
        Get
            Return mEstado.Trim.ToUpper
        End Get
        Set(ByVal value As String)
            If (value.Trim.ToUpper.Length = 1 And (value.Trim.ToUpper = "P" Or value.Trim.ToUpper = "C" Or value.Trim.ToUpper = "V" Or value.Trim.ToUpper = "E")) Then
                mEstado = value.Trim.ToUpper
            Else
                Throw New Exception("No se puede utilizar el estado del sorteo.")
            End If
        End Set
    End Property
    Public Property Producto() As clsCatalogo
        Get
            Return mProducto
        End Get
        Set(ByVal value As clsCatalogo)
            mProducto = value
        End Set
    End Property
    Public Property Cliente() As clsCliente
        Get
            Return mCliente
        End Get
        Set(ByVal value As clsCliente)
            mCliente = value
        End Set
    End Property
    Public Property Cod_Suc() As Int32
        Get
            Return mCod_Suc
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mCod_Suc = value
            Else
                Throw New Exception("Codigo de sucursal incorrecto")
            End If
        End Set
    End Property
    '/////////////////////////////////////////////////////////
    '/ Métodos de la Clase
    '/////////////////////////////////////////////////////////

    '---------------------------------------------------------------------
    ' Constructor de la Clase
    '---------------------------------------------------------------------
    Public Sub New()

        MyBase.New()

    End Sub
    '---------------------------------------------------------------------
    ' Destructor de la Clase
    '---------------------------------------------------------------------
    Public Sub Dispose()

        MyBase.Finalize()

    End Sub

End Class
